<template>
	<view class="content">
		<view class="title">
			<text>举报原因</text>
		</view>
		<view class="form-wrap">
			<textarea v-model="description" placeholder="请输入具体原因…" />
		</view>
		<view class="btn-wrap">
			<button type="primary" @click="submit">提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myInfo: {},
				touid: '',
				description: ''
			}
		},
		onLoad(options) {
			this.touid = options.touid
			uni.getStorage({
				key: 'myInfo',
				success: res => {
					this.myInfo = res.data;
				},
			});
		},
		methods: {
			submit: function () {
				if (this.description == '') {
					uni.showToast({
						title: '请输入具体原因',
						position: 'bottom',
						icon: 'none'
					});
					return false;
				}
				uni.showLoading({
					title: ''
				});
				this.$api.api.ajaxData({
					method: 'V1.EportUser',
					uid: this.myInfo.id,
					token: this.myInfo.token,
					touid: this.touid,
					description: this.description
				}, res => {
					uni.hideLoading();
					if (res.status) {
						uni.showToast({
							title: '提交成功',
							position: 'bottom',
							icon: 'none'
						})
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 1000);
					} else {
						uni.showToast({
							title: res.msg,
							position: 'bottom',
							icon: 'none'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F5F5F5;
	}
	.content {
		margin-top: 1rpx;
		background-color: #FFFFFF;
	}
	.title {
		padding: 25rpx;
		text {
			font-size: 36rpx;
			color: #333333;
		}
	}
	.form-wrap {
		padding: 0 20rpx;
		textarea {
			width: 100%;
			box-sizing: border-box;
			padding: 10rpx;
			border: 1rpx solid #efefef;
			border-radius: 5rpx;
			outline: none;
		}
	}
	.btn-wrap {
		padding: 80rpx 50rpx;
		button {
			border-radius: 80rpx;
		}
	}
</style>
